package com.lihao.sam.controller;

import com.lihao.sam.entity.User;
import com.lihao.sam.entity.xiaobei.AccommodationFeeCollection;
import com.lihao.sam.service.intf.AccommodationFeeCollectionService;
import com.lihao.sam.service.intf.UserService;
import com.lihao.sam.vo.PageVo;
import com.lihao.sam.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Author yifu
 * @Description UserController
 * @Date 13:10 2022/11/22
 */
@RestController
@RequestMapping("/api/accommodationFeeCollection/")
public class AccommodationFeeCollectionDaoController {
    @Resource
    private AccommodationFeeCollectionService service;

    @PostMapping("add.do")
    public R add(AccommodationFeeCollection accommodationFeeCollection){
        return service.add(accommodationFeeCollection);
    }
    @PostMapping("update.do")
    public R update(AccommodationFeeCollection accommodationFeeCollection){
        return service.update(accommodationFeeCollection);
    }
    @PostMapping("delete.do")
    public R delete(int id, HttpSession session){
        return service.delete(id);
    }
    @PostMapping("deletebatch.do")
    public R deleteBatch(int[] ids) {
        return service.delBatch(ids);
    }
    @GetMapping("page.do")
    public PageVo page(String studentid, String name1, String college, int page, int limit){
        return service.queryPage(studentid,name1, college, page, limit);
    }
    @PostMapping("upload.do")
    public R upload(MultipartFile file) throws IOException {
        return service.uploadExcel(file);
    }

    @GetMapping("download.do")
    public void download(HttpServletResponse response) throws IOException {
        service.exportData(response);
    }

}
